using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace Urovo
{
    public class Device
    {
        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool StartEngine();

        [DllImport("Native.dll")]
        public static extern void StopEngine();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ResetEngine();


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool StartScan();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool StopScan();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetBarcode(StringBuilder barcode, StringBuilder type);


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnableScaning();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool DisableScaning();

        [DllImport("Native.dll")]
        public static extern int GetScaningBarcode(StringBuilder barcode, StringBuilder type);


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnableGprs();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool DisableGprs();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetGprsPowerStatus();

        [DllImport("Native.dll")]
        public static extern int GetGprsSignalStrength();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnableWlan();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool DisableWlan();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetWlanPowerStatus();

        [DllImport("Native.dll")]
        public static extern int GetWlanSignalStrength();


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CheckNetworkStat();


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ConnectGprs([MarshalAs(UnmanagedType.LPWStr)]string connName);

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetGprsStatus([MarshalAs(UnmanagedType.LPWStr)]string connName);

        [DllImport("Native.dll")]
        public static extern void DisConnectGprs([MarshalAs(UnmanagedType.LPWStr)]string connName);


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ConnectWlan();


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SetBackLight(int level);


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CreatePowerEvent(out IntPtr suspendEvent, out IntPtr resumeEvent);

        [DllImport("Native.dll")]
        public static extern void ClosePowerEvent();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SuspendHold([MarshalAs(UnmanagedType.Bool)]bool isHold);

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool AlphaBlend(IntPtr dcDest, int x, int y, int cx, int cy, IntPtr dcSrc, int sx, int sy);


        [DllImport("Native.dll")]
        public static extern void GetDeviceID(StringBuilder deviceId);


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool StartScreenLock(uint idleTime);   //in seconds

        [DllImport("Native.dll")]
        public static extern void StopScreenLock();


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnableBluetooth();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool InitialBluetooth();

        [DllImport("Native.dll")]
        public static extern void DisableBluetooth();

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SetMac([MarshalAs(UnmanagedType.LPWStr)]string mac);

        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SetPin([MarshalAs(UnmanagedType.LPWStr)]string pin);


        [DllImport("Native.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SendToBT(byte[] buffer, uint bytesToWrite, out uint bytesWritten);

        [DllImport("Native.dll")]
        public static extern void ReleaseBT();

    }
}
